<template>
	<view>
		<!-- 地址 -->
		<view class="navbar" v-if="navList.length>0">
			<view v-for="(item, index) in navList" :key="index" class="nav-item" :class="{current: tabCurrentIndex === index}"
			 @click="tabClick(index,item)">
				{{item.text}}
			</view>
		</view>
		<navigator v-if="currentDeliveryType=='1'" url="/pages/address/address?source=1" class="address-section">
			<view class="order-content" v-if="addressData.name">
				<uni-icons type="location-filled" size="30"></uni-icons>
				<view class="cen">
					<view class="top">
						<text class="name">{{addressData.name}}</text>
						<text class="mobile">{{addressData.telephone}}</text>
					</view>
					<text class="address">{{addressData.province}}{{addressData.city}}{{addressData.area}}{{addressData.street}}</text>
				</view>
				<uni-icons type="right"></uni-icons>
			</view>
			<view class="order-content" v-if="!addressData.name">
				<uni-icons type="location-filled" size="30"></uni-icons>
				<view class="cen">
					<view class="top">
						<!-- <text class="name">{{addressData.name}}</text>
						<text class="mobile">{{addressData.telephone}}</text> -->
						<text>请选择地址</text>
					</view>
					<!-- <text class="address">{{addressData.street}}</text> -->
				</view>
				<uni-icons type="right"></uni-icons>
			</view>
			<image class="a-bg" src=""></image>
		</navigator>
		<view v-if="currentDeliveryType=='2'" class="delivery-section">
			<u-form :model="deliveryData">
				<u-form-item label="收件人姓名" label-width="250"><u-input type="text" v-model="deliveryData.deliveryName" placeholder="请输入姓名"/></u-form-item>
				<u-form-item label="收件人电话号码" label-width="250"><u-input type="number" v-model="deliveryData.deliveryContactNo" placeholder="请输入电话号码"/></u-form-item>
				<u-form-item label="收件地址" label-width="250" right-icon="arrow-right"><u-input readonly type="text" v-model="deliveryData.deliveryStreet"  placeholder="点击选择" @click="chooseLocation"/></u-form-item>
			</u-form>
		</view>
		<view v-if="currentDeliveryType=='3'" class="delivery-section">
			<u-form :model="deliveryData">
				<u-form-item label="提货人姓名" label-width="250"><u-input type="text" v-model="deliveryData.deliveryName" placeholder="请输入姓名"/></u-form-item>
				<u-form-item label="提货人电话号码" label-width="250"><u-input type="number" v-model="deliveryData.deliveryContactNo" placeholder="请输入电话号码"/></u-form-item>
			</u-form>
		</view>
		<view class="goods-section">
			<!-- 商品列表 -->
			<view v-for="cart in carts">
				<view class="store">
					<view class="m-name">
					{{cart.productDTO.merchantDTO.merchantName}}
					</view>
					<view class="m-address" v-if="currentDeliveryType=='3'" @click="openLocation(cart.productDTO.merchantDTO.latitude, cart.productDTO.merchantDTO.longitude)">
						{{cart.productDTO.merchantDTO.province||''}}{{cart.productDTO.merchantDTO.city||''}}{{cart.productDTO.merchantDTO.district||''}}{{cart.productDTO.merchantDTO.merchantAddress||''}}
					</view>
				</view>
				<view class="g-item">
					<image :src="cart.productDTO.productMainImage.url"></image>
					<view class="right">
						<text class="title clamp">{{cart.productDTO.productName}}</text>
						<text class="spec" v-if="cart.productDTO.skuEnabled">
							<text v-for="sku in cart.productSkuDTO.skuAttrValueList">{{sku.skuAttrValue}}</text>
						</text>
						<text class="spec" v-if="!cart.productDTO.skuEnabled">-</text>
						<view class="price-box">
							<text class="price">￥{{cart.unitPrice}}</text>
							<text class="number">x {{cart.unit}}</text>
						</view>
					</view>
				</view>
			</view>
		</view>
		<!-- 会员折扣 -->
		<view class="yt-list" v-if="discountAmount>0">
			<view class="yt-list-cell b-b">
				<text class="cell-tit clamp">{{userInfo.userLevelDTO.name+'享部分商品'+userInfo.userLevelDTO.productDiscount+'折'}}</text>
				<text class="cell-tip active">
					<text class="deduct-amount">
						{{discountAmount}}
					</text>
				</text>
			</view>
		</view>
		<!-- 优惠明细, 如果商品包含多个商家则不能使用优惠券 -->
		<view class="yt-list" v-if="!isMultipleMerchant">
			<view class="yt-list-cell b-b">
				<!-- <view class="yt-list-cell b-b" @click="toggleMask('show')"> -->
				<view class="cell-icon">
					券
				</view>
				<text class="cell-tit clamp">优惠券</text>
				<text class="cell-tip active" v-if="coupons.length==0">
					<text>无可用优惠券</text>
				</text>
				<text class="cell-tip active" v-if="coupons.length>0" @click="togglePopup('bottom', 'coupon')">
					<text v-if="!selectedCoupon.userCouponUuid">{{coupons.length}}张优惠券可用</text>
					<text class="coupon-name" v-if="selectedCoupon.userCouponUuid">
						{{selectedCoupon.couponDTO.name}}
					</text>
					<text class="deduct-amount" v-if="selectedCoupon.userCouponUuid">
						{{deductAmount}}
					</text>
				</text>
				<uni-icons class="close" type="clear" size="20" @click="clearSelectedCoupon" v-if="selectedCoupon.userCouponUuid"></uni-icons>
			</view>
		</view>
		<!-- 金额明细 -->
		<view class="yt-list">
			<view class="yt-list-cell b-b">
				<text class="cell-tit clamp">商品金额</text>
				<text class="cell-tip red">￥{{productAmount}}</text>
			</view>
			<view class="yt-list-cell b-b">
				<text class="cell-tit clamp">优惠金额</text>
				<text class="cell-tip">￥{{(deductAmount+discountAmount).toFixed(2)}}</text>
			</view>
			<view class="yt-list-cell b-b" v-if="currentDeliveryType=='1'">
				<text class="cell-tit clamp">运费</text>
				<text class="cell-tip">￥{{freightAmount.toFixed(2)}}</text>
			</view>
			<view class="yt-list-cell b-b" v-if="currentDeliveryType=='2'">
				<text class="cell-tit clamp">配送费</text>
				<text class="cell-tip">￥{{deliveryAmount.toFixed(2)}}</text>
			</view>
			<view class="yt-list-cell desc-cell">
				<text class="cell-tit clamp">备注</text>
				<input class="desc" type="text" v-model="memo" :placeholder="memoPlaceHolder" placeholder-class="placeholder" />
			</view>
		</view>

		<!-- 底部 -->
		<view class="footer">
			<view class="price-content">
				<text>实付款</text>
				<text class="price-tip">￥</text>
				<text class="price">{{actualAmount}}</text>
			</view>
			<text class="submit" @click="submit">提交订单</text>
		</view>

		<!-- 优惠券面板 -->
		<!-- 底部分享弹窗 -->
		<uni-popup ref="showcoupon" :type="type" @change="change">
			<scroll-view scroll-y="true" class="coupon-list" @touchmove.stop>
				<user-coupon-item :coupon="item" action-text="立即使用" @eventClick="selectCoupon(item)" v-for="item in coupons"></user-coupon-item>
			</scroll-view>
		</uni-popup>
		<u-modal @confirm="navigateBack" v-model="isMultipleProductType" :show-title="false"  :content="multipleProductTypeContent"></u-modal>
	</view>
</template>

<script>
	import {
		mapState,
		mapMutations
	} from 'vuex';
	import uniPopup from "@/components/uni-popup/uni-popup.vue"
	import userCouponItem from "@/components/user-coupon-item.vue"
	export default {
		data() {
			return {
				tabCurrentIndex:0,
				currentDeliveryType:'',
				isDeliveryExpressEnabled:true,
				isDeliveryCityEnabled:true,
				isDeliveryPickEnabled:true,
				navList: [],
				cartIds: [],
				carts: [], //结算的商品
				productAmount: 0.00, //商品金额, 未扣减任何优惠
				deductAmount: 0.00, //优惠金额
				actualAmount: 0.00, //实付金额
				freightAmount: 0.00, //运费
				discountAmount: 0.00, //折扣金额
				deliveryData:{},	//配送地址
				deliveryAmount: 0.00, //配送费
				addressData: {}, //收货地址
				maskState: 0, //优惠券面板显示状态
				memo: '', //备注
				memoPlaceHolder: '请填写备注信息',
				payType: 1, //1微信 2支付宝
				coupons: [], //有效优惠券
				selectedCoupon: {}, //选择使用的优惠券
				type: '',
				isMultipleMerchant: false, //订单是否包含多商家商品
				isMultipleProductType: false,//订单是否寄包含实物商品又包含虚拟商品
				multipleProductTypeContent: '订单中商品类型不一致(如实物商品, 虚拟商品, 电子卡券),需分开购买.'
			}
		},
		components: {
			uniPopup,
			userCouponItem
		},
		onLoad(option) {
			//商品数据
			var cart_id = JSON.parse(option.data);
			if (cart_id.length < 0) {
				uni.navigateBack({
					delta: 1
				})
			}
			this.cartIds = cart_id;
			this.inquiryProductByCartId(this.cartIds);
			//全局支持的配送方式
			if(!this.applicationConfig.applicationDeliveryExpressEnabled){
				this.isDeliveryExpressEnabled = false;
			}
			if(!this.applicationConfig.applicationDeliveryCityEnabled){
				this.isDeliveryCityEnabled = false;
			}
			if(!this.applicationConfig.applicationDeliveryPickEnabled){
				this.isDeliveryPickEnabled = false;
			}
			//会员折扣, 不依赖其他接口数据可以先加载
			this.calculateDiscountAmount();
		},
		computed: {
			...mapState(['hasLogin', 'userInfo', 'applicationConfig'])
		},
		watch: {
			addressData(val) {
				this.calculateFreightAmount(this.cartIds, val.province, val.city, val.area);
			}
		},
		methods: {
			navigateBack(){
				uni.navigateBack();
			},
			tabClick(index,item) {
				this.tabCurrentIndex = index;
				this.currentDeliveryType = item.state;
				if(this.currentDeliveryType=='1'){
					this.actualAmount = (this.productAmount - this.deductAmount - this.discountAmount + this.freightAmount).toFixed(2);
				}else if(this.currentDeliveryType=='2'){
					this.actualAmount = (this.productAmount - this.deductAmount - this.discountAmount + this.deliveryAmount).toFixed(2);
				}else if(this.currentDeliveryType=='3'){
					this.actualAmount = (this.productAmount - this.deductAmount - this.discountAmount).toFixed(2);
				}
			},
			//查询默认收货地址
			inquiryDefaultAddress(userUuid) {
				let that = this;
				let postData = {
					userDTO: {
						userUuid: userUuid
					}
				}
				this.$api.request.userShip(postData, res => {
					if (res.body.status.statusCode === '0') {
						res.body.data.addresses.forEach(function(val, index) {
							if (val.default) {
								that.addressData = val;
							}
						})
					} else {
						console.log(res.body.status.errorDesc);
					}
				});
			},
			//查询订单商品
			inquiryProductByCartId(cardIds) {
				let that = this;
				let postData = cardIds.split(',');
				this.$api.request.productByCardIds(postData, res => {
					if (res.body.status.statusCode === '0') {
						this.carts = res.body.data.carts;
						var productAmount = this.calcSelectedProductAmount(this.carts);
						this.productAmount = productAmount.toFixed(2);
						this.actualAmount = (this.productAmount - this.deductAmount - this.discountAmount + this.freightAmount).toFixed(2);
						var orderProductDTOList = [];
						//是否包含多个商家商品, 是否多支持快递配送, 同城配送, 门店自提
						this.carts.forEach(function(val,index){
							orderProductDTOList.push({
								productDTO:{
									productUuid: val.productDTO.productUuid
								},
								productUnit: val.unit,
								productUnitPrice: val.productDTO.unitPrice
							});
							if(that.carts[index].productDTO.merchantDTO.merchantUuid!=that.carts[0].productDTO.merchantDTO.merchantUuid){
								that.isMultipleMerchant = true;			
							}
							if(that.carts[index].productDTO.productType!=that.carts[0].productDTO.productType){
								that.isMultipleProductType = true;			
							}
							if(!that.carts[index].productDTO.deliveryExpressEnabled){
								that.isDeliveryExpressEnabled = false;
							}
							if(!that.carts[index].productDTO.deliveryCityEnabled){
								that.isDeliveryCityEnabled = false;
							}
							if(!that.carts[index].productDTO.deliveryPickEnabled){
								that.isDeliveryPickEnabled = false;
							}
						})
						//单商家商品, 搜索优惠券
						if(!that.isMultipleMerchant){
							that.searchCoupon();
							this.getBestCoupon(orderProductDTOList);
						}
						//虚拟商品提示填写联系方式
						if(this.carts[0].productDTO.productType=='2'){
							this.memoPlaceHolder = '虚拟商品, 请务必填写手机号码以便商家联系!';
						}
						//实物商品查询收货地址
						if(this.carts[0].productDTO.productType=='1')
							this.inquiryDefaultAddress(this.userInfo.userUuid);
						//商品支持的发货方式
						this.populateDeliveryType();
					} else {
						console.log(res.body.status.errorDesc);
					}
				});
			},
			//获取扣减最多的优惠券
			getBestCoupon(orderProductDTOList) {
				let that = this;
				let postData = {
					userDTO:{
						userUuid:this.userInfo.userUuid
					},
					merchantDTO:{
						merchantUuid: that.carts[0].productDTO.merchantDTO.merchantUuid
					},
					orderProductDTOList:orderProductDTOList
				};
				this.$api.request.bestCoupon(postData, res => {
					if (res.body.status.statusCode === '0') {
						var selectedCoupon = res.body.data;
						if(selectedCoupon){
							this.selectCoupon(selectedCoupon)
						}
					}
				}, true);
			},
			//打开商家地址
			openLocation(latitude,longitude){
				uni.openLocation({
					latitude: latitude,
					longitude: longitude,
					success: function () {
						console.log('打开地图成功');
					}
				});
			},
			//选择配送地址
			chooseLocation(){
				let that = this;
				uni.chooseLocation({
				    success: function (res) {
						that.$set(that.deliveryData, 'deliveryStreet', res.address+res.name);
						that.$set(that.deliveryData, 'deliveryLatitude', res.latitude);
						that.$set(that.deliveryData, 'deliveryLongitude', res.longitude);
						that.calculateDeliveryAmount(that.cartIds, res.latitude, res.longitude);
				    }
				});
			},
			//支持的发货方式
			populateDeliveryType(){
				if(this.isDeliveryExpressEnabled){
					this.navList.push({state:'1',text:'快递配送'});
				}
				if(this.isDeliveryCityEnabled){
					this.navList.push({state:'2',text:'同城配送'});
				}
				if(this.isDeliveryPickEnabled){
					this.navList.push({state:'3',text:'门店自提'});
				}
				if(this.navList.length>0)
					this.currentDeliveryType = this.navList[0].state;	//第一个为默认选择
			},
			//搜索可用优惠券
			searchCoupon() {
				var keyArray = ['USER', 'IS_EXPIRED', 'IS_USED', 'IS_STARTED'];
				let postData = {
					keyArray: keyArray,
					userUuid: this.userInfo.userUuid,
					expired: false,
					used: false,
					started: true,
					startIndex: 0,
					pageSize: 50 //默认查询50张有效优惠券, 用户大于50张则多余部分不会显示
				};
				//只查询适用于该商家的优惠券(不适用于跨商家订单)
				if(!this.isMultipleMerchant){
					keyArray.push('MERCHANT');
					postData.merchantUuid = this.carts[0].productDTO.merchantDTO.merchantUuid;
				}
				postData.keyArray = keyArray;
				//加载中
				this.$api.request.userCoupon(postData, res => {
					if (res.body.status.statusCode === '0') {
						var coupons = res.body.data.userCoupons;
						this.coupons = coupons;
					}
				}, true);
			},
			// 不使用优惠券
			clearSelectedCoupon() {
				this.selectedCoupon = {};
				this.deductAmount = 0.00;
				this.actualAmount = (this.productAmount - this.deductAmount - this.discountAmount + this.freightAmount).toFixed(2);
			},
			// 选中优惠券
			selectCoupon(item) {
				//计算当前商品使用优惠券后的优惠金额
				let postData = {
					shoppingCartUuidList: this.cartIds.split(','),
					userCouponDTO: {
						couponDTO: {
							couponUuid: item.couponDTO.couponUuid
						}
					}
				}
				this.$api.request.calculateCouponAmount(postData, res => {
					if (res.body.status.statusCode === '0') {
						this.deductAmount = res.body.data.deductAmount;
						this.actualAmount = (this.productAmount - this.deductAmount - this.discountAmount + this.freightAmount).toFixed(2);
						this.selectedCoupon = item;
						this.$refs.showcoupon.close();
					} else {
						this.$api.msg(res.body.status.errorDesc);
					}
				}, false);
			},
			//计算会员折扣金额
			calculateDiscountAmount() {
				let postData = {
					userDTO:{
						userUuid:this.userInfo.userUuid
					},
					shoppingCartUuidList: this.cartIds.split(','),
				};
				this.$api.request.calculateDiscountAmount(postData, res => {
					if (res.body.status.statusCode === '0') {
						this.discountAmount = res.body.data.discountAmount;
						this.actualAmount = (this.productAmount - this.deductAmount - this.discountAmount + this.freightAmount).toFixed(2);
					}
				}, true);
			},
			// 计算运费金额
			calculateFreightAmount(item, province, city, area) {
				let postData = {
					shoppingCartUuidList: this.cartIds.split(','),
					deliveryProvince: province,
					deliveryCity: city,
					deliveryArea: area
				}
				this.$api.request.calculateFreightAmount(postData, res => {
					if (res.body.status.statusCode === '0') {
						this.freightAmount = res.body.data.freightAmount;
						this.actualAmount = (this.productAmount - this.deductAmount - this.discountAmount + this.freightAmount).toFixed(2);
					} else {
						this.$api.msg(res.body.status.errorDesc);
					}
				}, false);
			},
			// 计算同城配送费金额
			calculateDeliveryAmount(item, deliveryLatitude, deliveryLongitude) {
				let postData = {
					shoppingCartUuidList: this.cartIds.split(','),
					deliveryLatitude: deliveryLatitude,
					deliveryLongitude: deliveryLongitude
				}
				this.$api.request.calculateDeliveryAmount(postData, res => {
					if (res.body.status.statusCode === '0') {
						this.deliveryAmount = res.body.data.deliveryAmount;
						//同城配送
						if(this.currentDeliveryType=='2')
							this.actualAmount = this.productAmount - this.deductAmount + this.deliveryAmount;
					} else {
						this.$api.msg(res.body.status.errorDesc);
					}
				}, false);
			},
			//计算总金额
			calcSelectedProductAmount(cartData) {
				var amount = 0;
				cartData.forEach(function(val, index) {
					amount = amount + val.unitPrice * val.unit;
				})
				return amount;
			},
			change(e) {
				console.log('是否打开:' + e.show)
			},
			togglePopup(type, open) {
				switch (type) {
					case 'top':
						this.content = '顶部弹出 popup'
						break

					case 'bottom':
						this.content = '底部弹出 popup'
						break
					case 'center':
						this.content = '居中弹出 popup'
						break
				}
				this.type = type
				this.$nextTick(() => {
					this.$refs['show' + open].open()
				})
			},
			//显示优惠券面板
			toggleMask(type) {
				let timer = type === 'show' ? 10 : 300;
				let state = type === 'show' ? 1 : 0;
				this.maskState = 2;
				setTimeout(() => {
					this.maskState = state;
				}, timer)
			},
			numberChange(data) {
				this.number = data.number;
			},
			changePayType(type) {
				this.payType = type;
			},
			submit() {
				//检查收货地址是否选择
				if ((this.currentDeliveryType=='1')&&!this.addressData.userDeliveryAddressUuid) {
					this.$api.msg('未选择快递收货地址');
					return;
				}
				//检查配送地址是否选择
				if ((this.currentDeliveryType=='2')&&(!this.deliveryData.deliveryStreet||!this.deliveryData.deliveryName||!this.deliveryData.deliveryContactNo)) {
					this.$api.msg('配送地址未填写完整');
					return;
				}
				//检查提货人是否选择
				if ((this.currentDeliveryType=='3')&&(!this.deliveryData.deliveryName||!this.deliveryData.deliveryContactNo)) {
					this.$api.msg('提货人信息未填写完整');
					return;
				}
				//post订单数据到后台
				let postData = {
					actionType: 'ADD',
					userDTO: {
						userUuid: this.userInfo.userUuid
					},
					deliveryAddressDTO: {
						userDeliveryAddressUuid: this.addressData.userDeliveryAddressUuid
					},
					deliveryName: this.deliveryData.deliveryName,
					deliveryContactNo: this.deliveryData.deliveryContactNo,
					deliveryLatitude: this.deliveryData.deliveryLatitude,
					deliveryLongitude: this.deliveryData.deliveryLongitude,
					deliveryStreet: this.deliveryData.deliveryStreet,
					deliveryType: this.currentDeliveryType,
					memo: this.memo,
					shoppingCartUuidList: this.cartIds.split(',')
				}
				if (this.selectedCoupon.userCouponUuid) {
					postData.userCouponDTO = {
						userCouponUuid: this.selectedCoupon.userCouponUuid,
						couponDTO: {
							couponUuid: this.selectedCoupon.couponDTO.couponUuid
						}
					}
				}
				this.$api.request.createOrder(postData, res => {
					if (res.body.status.statusCode === '0') {
						uni.redirectTo({
							url: '/pages/money/pay?pOrderNo=' + res.body.data.pOrderNo
						})
					} else {
						this.$api.msg(res.body.status.errorDesc);
					}
				});

			},
			stopPrevent() {}
		}
	}
</script>

<style lang="scss">
	page {
		background: $page-color-base;
		padding-bottom: 100upx;
	}

	.address-section {
		padding: 30upx 0;
		background: #fff;
		position: relative;

		.order-content {
			display: flex;
			align-items: center;
		}

		.cen {
			display: flex;
			flex-direction: column;
			flex: 1;
			font-size: 28upx;
			color: $font-color-dark;
		}

		.name {
			font-size: 34upx;
			margin-right: 24upx;
		}

		.address {
			margin-top: 16upx;
			margin-right: 20upx;
			color: $font-color-light;
		}

		.icon-you {
			font-size: 32upx;
			color: $font-color-light;
			margin-right: 30upx;
		}

		.a-bg {
			position: absolute;
			left: 0;
			bottom: 0;
			display: block;
			width: 100%;
			height: 5upx;
		}
	}
	
	.store{
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		margin: 40upx 30upx 0 30upx;
		font-size: $font-sm;
		color: $font-color-dark;
		.m-name{
			overflow: hidden;
			text-overflow: ellipsis;
			white-space: nowrap;
			font-size: $font-lg;
			color: $font-color-dark;
		}
		.m-address{
			overflow: hidden;
			text-overflow: ellipsis;
			white-space: nowrap;
			max-width: 200px;
			font-size: $font-sm;
			color: $font-color-light;
		}
	}
	.delivery-section{
		background-color: #fff;
		padding: 20upx 30upx 0 30upx;
	}
	.goods-section {
		margin-top: 16upx;
		background: #fff;
		padding-bottom: 1px;

		.g-header {
			display: flex;
			align-items: center;
			height: 84upx;
			padding: 0 30upx;
			position: relative;
		}

		.logo {
			display: block;
			width: 50upx;
			height: 50upx;
			border-radius: 100px;
		}

		.name {
			font-size: 30upx;
			color: $font-color-base;
			margin-left: 24upx;
		}

		.g-item {
			display: flex;
			margin: 20upx 30upx;

			image {
				flex-shrink: 0;
				display: block;
				width: 140upx;
				height: 140upx;
				border-radius: 4upx;
			}

			.right {
				flex: 1;
				padding-left: 24upx;
				overflow: hidden;
			}

			.title {
				font-size: 30upx;
				color: $font-color-dark;
			}

			.spec {
				font-size: 26upx;
				color: $font-color-light;
			}

			.price-box {
				display: flex;
				align-items: center;
				font-size: 32upx;
				color: $font-color-dark;
				padding-top: 10upx;

				.price {
					margin-bottom: 4upx;
				}

				.number {
					font-size: 26upx;
					color: $font-color-base;
					margin-left: 20upx;
				}
			}

			.step-box {
				position: relative;
			}
		}
	}

	.yt-list {
		margin-top: 16upx;
		background: #fff;
	}

	.yt-list-cell {
		display: flex;
		align-items: center;
		padding: 10upx 30upx 10upx 40upx;
		line-height: 70upx;
		position: relative;

		&.cell-hover {
			background: $page-color-light;
		}

		&.b-b:after {
			left: 30upx;
		}

		.cell-icon {
			height: 32upx;
			width: 32upx;
			font-size: 22upx;
			color: #fff;
			text-align: center;
			line-height: 32upx;
			background: $uni-color-error;
			border-radius: 4upx;
			margin-right: 12upx;

		}

		.cell-more {
			align-self: center;
			font-size: 24upx;
			color: $font-color-light;
			margin-left: 8upx;
			margin-right: -10upx;
		}

		.cell-tit {
			flex: 1;
			font-size: 26upx;
			color: $font-color-light;
			margin-right: 10upx;
		}

		.cell-tip {
			font-size: 26upx;
			color: $font-color-light;
			.deduct-amount{
				margin-left:20upx;
				&::before{
					content: '-￥';
				}
			}
			&.disabled {
				color: $font-color-light;
			}

			&.active {
				color: $base-color;
			}

			&.red {
				color: $base-color;
			}

			& .close {
				color: $font-color-light;
				margin-left: 20upx;
			}
		}

		&.desc-cell {
			.cell-tit {
				max-width: 90upx;
			}
		}

		.desc {
			flex: 1;
			font-size: $font-base;
			color: $font-color-dark;
		}
	}

	.footer {
		position: fixed;
		left: 0;
		bottom: 0;
		z-index: 995;
		display: flex;
		align-items: center;
		width: 100%;
		height: 90upx;
		justify-content: space-between;
		font-size: 30upx;
		background-color: #fff;
		z-index: 998;
		color: $font-color-base;

		.price-content {
			padding-left: 30upx;
		}

		.price-tip {
			color: $base-color;
			margin-left: 8upx;
		}

		.price {
			font-size: 36upx;
			color: $base-color;
		}

		.submit {
			display: flex;
			align-items: center;
			justify-content: center;
			width: 280upx;
			height: 100%;
			color: #fff;
			font-size: 32upx;
			background-color: $base-color;
		}
	}

	.coupon-list {
		display: flex;
		flex-wrap: wrap;
		padding: 0 10upx;
		border-radius: 20upx;
		margin-bottom: 100upx;
		max-height: 700upx;
	}
	.navbar {
		display: flex;
		height: 40px;
		padding: 0 5px;
		background: #fff;
		/* position: relative; */
		z-index: 10;
	
		.nav-item {
			flex: 1;
			display: flex;
			justify-content: center;
			align-items: center;
			height: 100%;
			font-size: 15px;
			color: $font-color-dark;
			position: relative;
	
			&.current {
				color: $base-color;
	
				&:after {
					content: '';
					position: absolute;
					left: 50%;
					bottom: 0;
					transform: translateX(-50%);
					width: 44px;
					height: 0;
					border-bottom: 2px solid $base-color;
				}
			}
		}
	}
</style>
